#include<bits/stdc++.h>
#define ll long long
#define L xd[x].l
#define R xd[x].r
#define mid (l+r>>1)
#define lc L,l,mid
#define rc R,mid+1,r
#define OK Ll<=l&&r<=Rr
#define Root 1,1,m
#define rep(x,y,z) for(int x=(y);x<=(z);x++)
#define per(x,y,z) for(int x=(y);x>=(z);x--)
#define repn(x) rep(x,1,n)
#define repm(x) rep(x,1,m)
#define pb push_back
#define e(x) for(int i=h[x],y=to[i];i;i=nxt[i],y=to[i])
#define E(x) for(auto y:p[x])
#define Pi pair<int,int>
#define ui unsigned ll
inline int read(){int s=0,w=1;char c=getchar();while(c<48||c>57) {if(c=='-') w=-1;c=getchar();}while(c>=48&&c<=57)s=(s<<1)+(s<<3)+c-48,c=getchar();return s*w;}
inline void pf(int x){if(x<0) putchar('-'),x=-x;if(x>9)pf(x/10);putchar(x%10+48);}
using namespace std;
const int N=2e5+10,M=6e6+5,inf=(1LL<<30)-1,mod=998244353;
const ll llf=1e18;
inline void add(int &a,int b){((a+=b)>=mod) and (a-=mod);}
inline int Add(int a,int b){return add(a,b),a;}
inline int mul(int a,int b){return 1LL*a*b%mod;}
inline void Mul(int &a,int b){a=mul(a,b);}
inline void red(int &a,int b){add(a,mod-b);}
inline int Red(int a,int b){return red(a,b),a;}
inline int qp(int a,int b){if(!b)return 1;int c=qp(a,b>>1);Mul(c,c);if(b&1)Mul(c,a);return c;}
inline int INV(int x){return qp(x,mod-2);}
int n,k,m=2e5,K;
struct node{
	int a,h;
}a[N],b[N],c[N];
int nl,nr,Mn[N],tot;
bool v[N];
inline bool cmp(node a,node b){
	return a.a<b.a;
}
inline ll calc(node a,int atk){
	return 1LL*a.a*((a.h+atk-1)/atk-1);
}
struct segment{
	ll k,b;
}d[M];
int cnt;
ll pr[N],dp[N];
inline ll get(int x){
	if(x<=0)return 0;
	return pr[x];
}
inline ll gets(int w,int id){
	return d[id].k*w+d[id].b;
}
struct seg{
	int l,r,k;
}xd[M*4];
inline void pushdown(int x,int l,int r,int id){
	if(!xd[x].k)xd[x].k=id;
	if(gets(mid,id)<gets(mid,xd[x].k))swap(xd[x].k,id);
	if(gets(l,id)<gets(l,xd[x].k)){
		if(!L)L=++tot;
		pushdown(lc,id);
	}
	if(gets(r,id)<gets(r,xd[x].k)){
		if(!R)R=++tot;
		pushdown(rc,id);
	}
}
int root[N<<2];
inline void build(int x,int l,int r){
	root[x]=++tot;
	if(l^r)build(x<<1,l,mid),build(x<<1|1,mid+1,r);
}
inline void modify(int x,int l,int r,int Ll,int Rr,int id){
	if(OK)return pushdown(root[x],1,m,id),void();
	if(Ll<=mid)modify(x<<1,l,mid,Ll,Rr,id);
	if(Rr>mid)modify(x<<1|1,mid+1,r,Ll,Rr,id);
}
inline ll query(int x,int l,int r,int p){
	if(!xd[x].k)return llf;
	ll ans=gets(p,xd[x].k);
	if(l==r)return ans;
	return min(ans,p<=mid?query(lc,p):query(rc,p));
}
inline ll Query(int x,int l,int r,int p1,int p2){
	ll ans=query(root[x],1,m,p2);
	if(l==r)return ans;
	return min(ans,p1<=mid?Query(x<<1,l,mid,p1,p2):Query(x<<1|1,mid+1,r,p1,p2));
}
const int B=1000;
vector<int>p;
inline void sol(int id){
	if(b[id].a<=B)return p.pb(id),void();
	
	for(int l=1;l<=m;l+=b[id].a){
		int r=min(m,l+b[id].a-1);
		d[++cnt]={(r+b[id].a-1)/b[id].a,dp[id]-pr[id]};
		modify(Root,l,r,cnt);
	}
}
inline void Main(){
	n=read(),k=read(),d[0].b=llf;
	repm(i)Mn[i]=inf;
	repn(i)a[i].a=read(),a[i].h=read(),Mn[a[i].a]=min(Mn[a[i].a],a[i].h);
	repn(i)if(a[i].a<=k)c[++nr]=a[i];
	else if(a[i].h==Mn[a[i].a]&&!v[a[i].a])v[a[i].a]=1,b[++nl]=a[i];
	else c[++nr]=a[i];
	sort(b+1,b+nl+1,cmp);
	if(!nl){
		ll ans=0;
		rep(i,1,nr)ans+=calc(c[i],k);
		cout <<ans;
		return;
	}
	if(nl==1){
		ll ans=calc(b[1],k);
		rep(i,1,nr)ans+=calc(c[i],b[1].a);
		cout <<ans;
		return;
	}
	n=nl;
	repn(i)pr[i]=pr[i-1]+calc(b[i],b[n].a);
	rep(i,0,n)dp[i]=llf;
	dp[0]=0,b[0].a=k;
	build(Root);
	sol(0);
	repn(i){
		dp[i]=Query(Root,b[i].h,b[i].a)+pr[i-1]-b[i].a;
		for(auto j:p)dp[i]=min(dp[i],dp[j]+pr[i-1]-pr[j]+calc(b[i],b[j].a));
		sol(i);
	}
	ll ans=dp[n];
	rep(i,1,nr)ans+=calc(c[i],b[n].a);
	cout <<ans;
}
signed main(){
	freopen("xinyue.in","r",stdin);
	freopen("xinyue.out","w",stdout);
	int T=1;
	while(T--)Main();
	return 0;
}